From f4825dd3853188de4688fb4a56c0f4e847da314b Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 23 Jun 2025 13:31:14 +0000 Subject: (김준회) SAML 2.0 SSO 처리 - HTTP / HTTPS 대응 처리 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/auth/[...nextauth]/saml/provider.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/api/auth/[...nextauth]') diff --git a/app/api/auth/[...nextauth]/saml/provider.ts b/app/api/auth/[...nextauth]/saml/provider.ts index 1f891661..8486a690 100644 --- a/app/api/auth/[...nextauth]/saml/provider.ts +++ b/app/api/auth/[...nextauth]/saml/provider.ts @@ -248,7 +248,11 @@ export async function createNextAuthToken(user: User): Promise { // NextAuth 세션 쿠키 이름 가져오기 export function getSessionCookieName(): string { - return process.env.NODE_ENV === 'production' + // NEXTAUTH_URL이 HTTPS인 경우에만 __Secure- 접두사 사용 + const nextAuthUrl = process.env.NEXTAUTH_URL || ''; + const isHttps = nextAuthUrl.startsWith('https://'); + + return isHttps ? '__Secure-next-auth.session-token' : 'next-auth.session-token'; } -- cgit v1.2.3